package com.yc.sole.common.enums;

import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 审批动作
 *
 * @author yizuomin
 * @date 2023/12/24 23:33
 **/
@Getter
@AllArgsConstructor
public enum ApprovalAction implements IBaseEnum<String> {

    /**
     *
     */
    SUBMIT("0", "提交审批"),
    PASS("1", "通过审批"),
    REJECT("2", "驳回审批"),
    REVOKE("3", "撤回审批");

    @JsonValue
    private final String value;
    private final String description;

    /**
     * 根据审批状态获取描述
     *
     * @param action
     * @return
     */
    public static String getDescByValue(ApprovalAction action) {
        for (ApprovalAction value : ApprovalAction.values()) {
            if (value.equals(action)) {
                return value.getDescription();
            }
        }
        return null;
    }
}
